DPWorkerThread now sets up a coroutine stack.
[hom.git] / Tests / Unit Tests / DPCoroutineSingleThreadTests.m
bloba5582cc68fde67dfdb02f5fb583a26bb55830c48
1 //
2 //  DPCoroutineSingleThreadTests.m
3 //  HigherOrderMessaging
4 //
5 //  Created by Ofri Wolfus on 02/08/07.
6 //  Copyright 2007 Ofri Wolfus. All rights reserved.
7 //
9 #import "DPCoroutineSingleThreadTests.h"
10 #import "DPCoroutine.h"
13 @implementation DPCoroutineSingleThreadTests
15 - (unsigned)numberOfIterations {
16         return 20;
19 - (void)incByTwo {
20         while (count < 10) {
21                 count += 2;
22                 DPCoroutineYield();
23         }
26 - (void)decByOne {
27         while (count < 10) {
28                 --count;
29                 DPCoroutineYield();
30         }
33 - (void)finishSingleThreadTest {
34         while (count < 10)
35                 DPCoroutineYield();
36         
37         [self setStatus:YES forPendingTest:@"testSingleThread"];
40 - (void)testSingleThread {
41         count = 0;
42         [self coroutine:MSG(finishSingleThreadTest)];
43         [self coroutine:MSG(incByTwo)];
44         [self coroutine:MSG(decByOne)];
47 @end